package com.yzh.other;

/**
 * 定义枚举
 * public enum Gender {
 *     男,女
 * }
 * 将变量定义枚举类型
 * private Gender sex;
 *
 * 枚举变量的赋值
 * Person person = new Person("张三",Gender.男);
 *
 */
public class Person {
    private String name;
    private Gender sex;

    public Person() {
    }

    public Person(String name, Gender sex) {
        this.name = name;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Gender getSex() {
        return sex;
    }

    public void setSex(Gender sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                '}';
    }

    public static void main(String[] args) {
        Person person = new Person("张三",Gender.男);
        System.out.println(person);
    }
}
